const url = require("url")
const qs = require("querystring")

let urlstr = "https://www.baidu.com/s?wd=%E8%A7%86%E8%A7%89%E4%B8%AD%E5%9B%BD&rsv_spt=1&rsv_iqid=0xfbb1e39600019896&issp=1&f=3&rsv_bp=1&rsv_idx=2&ie=utf-8&rqlang=cn&tn=baiduhome_pg&rsv_enter=1&rsv_dl=ts_2&oq=%25E8%25A7%2586%25E8%25A7%2589&rsv_t=4cecG5%2BgIBH9N5aA6MrAZMYc3t05a%2BCrPxsBdByFfSMTsuRsZXgy7voAO6QcGadnmRT%2B&rsv_sug3=3&rsv_sug1=3&rsv_sug7=100&rsv_pq=c009284500015d66&rsv_sug2=1&prefixsug=%25E8%25A7%2586%25E8%25A7%2589&rsp=2&rsv_sug4=3214";

let s ;

s = url.parse(urlstr);

// console.log(s)

let strjson = {
	protocol: 'https:',
	slashes: true,
	auth: null,
	host: 'www.baidu.com',
	port: null,
	hostname: 'www.baidu.com',
	hash: null,
	search: '?wd=%E8%A7%86%E8%A7%89%E4%B8%AD%E5%9B%BD&rsv_spt=1&rsv_iqid=0xfbb1e39600019896&issp=1&f=3&rsv_bp=1&rsv_idx=2&ie=utf-8&rqlang=cn&tn=baiduhome_pg&rsv_enter=1&rsv_dl=ts_2&oq=%25E8%25A7%2586%25E8%25A7%2589&rsv_t=4cecG5%2BgIBH9N5aA6MrAZMYc3t05a%2BCrPxsBdByFfSMTsuRsZXgy7voAO6QcGadnmRT%2B&rsv_sug3=3&rsv_sug1=3&rsv_sug7=100&rsv_pq=c009284500015d66&rsv_sug2=1&prefixsug=%25E8%25A7%2586%25E8%25A7%2589&rsp=2&rsv_sug4=3214',
	query: 'wd=%E8%A7%86%E8%A7%89%E4%B8%AD%E5%9B%BD&rsv_spt=1&rsv_iqid=0xfbb1e39600019896&issp=1&f=3&rsv_bp=1&rsv_idx=2&ie=utf-8&rqlang=cn&tn=baiduhome_pg&rsv_enter=1&rsv_dl=ts_2&oq=%25E8%25A7%2586%25E8%25A7%2589&rsv_t=4cecG5%2BgIBH9N5aA6MrAZMYc3t05a%2BCrPxsBdByFfSMTsuRsZXgy7voAO6QcGadnmRT%2B&rsv_sug3=3&rsv_sug1=3&rsv_sug7=100&rsv_pq=c009284500015d66&rsv_sug2=1&prefixsug=%25E8%25A7%2586%25E8%25A7%2589&rsp=2&rsv_sug4=3214',
	pathname: '/s',
	path: '/s?wd=%E8%A7%86%E8%A7%89%E4%B8%AD%E5%9B%BD&rsv_spt=1&rsv_iqid=0xfbb1e39600019896&issp=1&f=3&rsv_bp=1&rsv_idx=2&ie=utf-8&rqlang=cn&tn=baiduhome_pg&rsv_enter=1&rsv_dl=ts_2&oq=%25E8%25A7%2586%25E8%25A7%2589&rsv_t=4cecG5%2BgIBH9N5aA6MrAZMYc3t05a%2BCrPxsBdByFfSMTsuRsZXgy7voAO6QcGadnmRT%2B&rsv_sug3=3&rsv_sug1=3&rsv_sug7=100&rsv_pq=c009284500015d66&rsv_sug2=1&prefixsug=%25E8%25A7%2586%25E8%25A7%2589&rsp=2&rsv_sug4=3214',
	href: 'https://www.baidu.com/s?wd=%E8%A7%86%E8%A7%89%E4%B8%AD%E5%9B%BD&rsv_spt=1&rsv_iqid=0xfbb1e39600019896&issp=1&f=3&rsv_bp=1&rsv_idx=2&ie=utf-8&rqlang=cn&tn=baiduhome_pg&rsv_enter=1&rsv_dl=ts_2&oq=%25E8%25A7%2586%25E8%25A7%2589&rsv_t=4cecG5%2BgIBH9N5aA6MrAZMYc3t05a%2BCrPxsBdByFfSMTsuRsZXgy7voAO6QcGadnmRT%2B&rsv_sug3=3&rsv_sug1=3&rsv_sug7=100&rsv_pq=c009284500015d66&rsv_sug2=1&prefixsug=%25E8%25A7%2586%25E8%25A7%2589&rsp=2&rsv_sug4=3214'
  }

let b = url.format(strjson)

// console.log(b)
let qus = s.query;
qus = "name-视觉中国@type-plau"
let obj = qs.parse(qus,"@","-");

console.log(qs.stringify(obj,"@","-"))


